<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title></title>
</head>
<body>

</body>
</html>
<script>
    //把大象装冰箱分几步
    var door;
    var box;
    function open(){
        door = true;
    }
    open();
    function put(){
        var daxiang = '大象';
        box = daxiang;
    }
    put();
    function close(){
        door = false;
    }
    close();

    //如果用面对对象的方式来写这个
    var box = {
        door : null,
        box : null,
        open : function(){
            door = true;
            alert('冰箱门开开了');
            return this;
        },
        put : function(){
            var daxiang = '大象';
            box = daxiang;
            alert('大象放进去了');
            return this;
        },
        close : function(){
            door = false;
            alert('冰箱门关闭了');
            return this;
        }
    }
    box.open().put().close();
</script>